package person.wend.springbootlearnexample.controller;

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import person.wend.springbootlearnexample.pojo.User;

@Path("/user")
public class UserJerseyController {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public User getUser() {
        User user = new User("John", 30);
        return user;
    }


    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response createUser(User user) {
        // 处理用户创建逻辑
        return Response.status(Response.Status.CREATED).entity(user).build();
    }
}
